using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._SpatialStatisticsTools._ModelingSpatialRelationships
{
    /// <summary>
    /// <para>Generalized Linear Regression </para>
    /// <para>Performs Generalized Linear Regression 
    /// (GLR) to generate predictions or to model a dependent variable in terms of its relationship to a set of explanatory variables.  This tool can be used to fit continuous (OLS), binary (logistic), and count (Poisson) models.</para>
    /// <para>执行广义线性回归
    /// （GLR） 根据因变量与一组解释变量的关系生成预测或建模。 此工具可用于拟合连续 （OLS）、二进制 （logistic） 和计数 （Poisson） 模型。</para>
    /// </summary>    
    [DisplayName("Generalized Linear Regression ")]
    public class GeneralizedLinearRegression : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public GeneralizedLinearRegression()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_features">
        /// <para>Input Features</para>
        /// <para>The feature class containing the dependent and independent variables.</para>
        /// <para>包含因变量和自变量的要素类。</para>
        /// </param>
        /// <param name="_dependent_variable">
        /// <para>Dependent Variable</para>
        /// <para>The numeric field containing the observed values to be modeled.</para>
        /// <para>包含要建模的观测值的数值字段。</para>
        /// </param>
        /// <param name="_model_type">
        /// <para>Model Type</para>
        /// <para><xdoc>
        ///   <para>Specifies the type of data that will be modeled.</para>
        ///   <bulletList>
        ///     <bullet_item>Continuous (Gaussian)— The Dependent Variable is continuous. The model used is Gaussian, and the tool performs ordinary least squares regression.</bullet_item><para/>
        ///     <bullet_item>Binary (Logistic)— The Dependent Variable represents presence or absence. This can be either conventional 1s and 0s, or continuous data that has been recoded based on some threshold value. The model used is Logistic Regression.</bullet_item><para/>
        ///     <bullet_item>Count (Poisson)—The Dependent Variable is discrete and represents events, for example, crime counts, disease incidents, or traffic accidents. The model used is Poisson regression.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定要建模的数据类型。</para>
        ///   <bulletList>
        ///     <bullet_item>连续（高斯）— 因变量是连续的。使用的模型是高斯模型，该工具执行普通最小二乘回归。</bullet_item><para/>
        ///     <bullet_item>二进制 （Logistic）— 因变量表示存在或不存在。这可以是传统的 1 和 0，也可以是根据某个阈值重新编码的连续数据。使用的模型是逻辑回归。</bullet_item><para/>
        ///     <bullet_item>计数 （Poisson） - 因变量是离散变量，表示事件，例如犯罪计数、疾病事件或交通事故。使用的模型是泊松回归。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// </param>
        /// <param name="_output_features">
        /// <para>Output Features</para>
        /// <para>The new feature class that will contain the dependent variable estimates and residuals.</para>
        /// <para>将包含因变量估计值和残差的新要素类。</para>
        /// </param>
        public GeneralizedLinearRegression(object _in_features, object _dependent_variable, _model_type_value _model_type, object _output_features)
        {
            this._in_features = _in_features;
            this._dependent_variable = _dependent_variable;
            this._model_type = _model_type;
            this._output_features = _output_features;
        }
        public override string ToolboxName => "Spatial Statistics Tools";

        public override string ToolName => "Generalized Linear Regression ";

        public override string CallName => "stats.GeneralizedLinearRegression";

        public override List<string> AcceptEnvironments => ["outputCoordinateSystem"];

        public override object[] ParameterInfo => [_in_features, _dependent_variable, _model_type.GetGPValue(), _output_features, _explanatory_variables, _distance_features, _prediction_locations, _explanatory_variables_to_match, _explanatory_distance_matching, _output_predicted_features];

        /// <summary>
        /// <para>Input Features</para>
        /// <para>The feature class containing the dependent and independent variables.</para>
        /// <para>包含因变量和自变量的要素类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Features")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_features { get; set; }


        /// <summary>
        /// <para>Dependent Variable</para>
        /// <para>The numeric field containing the observed values to be modeled.</para>
        /// <para>包含要建模的观测值的数值字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Dependent Variable")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _dependent_variable { get; set; }


        /// <summary>
        /// <para>Model Type</para>
        /// <para><xdoc>
        ///   <para>Specifies the type of data that will be modeled.</para>
        ///   <bulletList>
        ///     <bullet_item>Continuous (Gaussian)— The Dependent Variable is continuous. The model used is Gaussian, and the tool performs ordinary least squares regression.</bullet_item><para/>
        ///     <bullet_item>Binary (Logistic)— The Dependent Variable represents presence or absence. This can be either conventional 1s and 0s, or continuous data that has been recoded based on some threshold value. The model used is Logistic Regression.</bullet_item><para/>
        ///     <bullet_item>Count (Poisson)—The Dependent Variable is discrete and represents events, for example, crime counts, disease incidents, or traffic accidents. The model used is Poisson regression.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定要建模的数据类型。</para>
        ///   <bulletList>
        ///     <bullet_item>连续（高斯）— 因变量是连续的。使用的模型是高斯模型，该工具执行普通最小二乘回归。</bullet_item><para/>
        ///     <bullet_item>二进制 （Logistic）— 因变量表示存在或不存在。这可以是传统的 1 和 0，也可以是根据某个阈值重新编码的连续数据。使用的模型是逻辑回归。</bullet_item><para/>
        ///     <bullet_item>计数 （Poisson） - 因变量是离散变量，表示事件，例如犯罪计数、疾病事件或交通事故。使用的模型是泊松回归。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Model Type")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public _model_type_value _model_type { get; set; }

        public enum _model_type_value
        {
            /// <summary>
            /// <para>Continuous (Gaussian)</para>
            /// <para>Continuous (Gaussian)— The Dependent Variable is continuous. The model used is Gaussian, and the tool performs ordinary least squares regression.</para>
            /// <para>连续（高斯）— 因变量是连续的。使用的模型是高斯模型，该工具执行普通最小二乘回归。</para>
            /// </summary>
            [Description("Continuous (Gaussian)")]
            [GPEnumValue("CONTINUOUS")]
            _CONTINUOUS,

            /// <summary>
            /// <para>Binary (Logistic)</para>
            /// <para>Binary (Logistic)— The Dependent Variable represents presence or absence. This can be either conventional 1s and 0s, or continuous data that has been recoded based on some threshold value. The model used is Logistic Regression.</para>
            /// <para>二进制 （Logistic）— 因变量表示存在或不存在。这可以是传统的 1 和 0，也可以是根据某个阈值重新编码的连续数据。使用的模型是逻辑回归。</para>
            /// </summary>
            [Description("Binary (Logistic)")]
            [GPEnumValue("BINARY")]
            _BINARY,

            /// <summary>
            /// <para>Count (Poisson)</para>
            /// <para>Count (Poisson)—The Dependent Variable is discrete and represents events, for example, crime counts, disease incidents, or traffic accidents. The model used is Poisson regression.</para>
            /// <para>计数 （Poisson） - 因变量是离散变量，表示事件，例如犯罪计数、疾病事件或交通事故。使用的模型是泊松回归。</para>
            /// </summary>
            [Description("Count (Poisson)")]
            [GPEnumValue("COUNT")]
            _COUNT,

        }

        /// <summary>
        /// <para>Output Features</para>
        /// <para>The new feature class that will contain the dependent variable estimates and residuals.</para>
        /// <para>将包含因变量估计值和残差的新要素类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Features")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _output_features { get; set; }


        /// <summary>
        /// <para>Explanatory Variable(s)</para>
        /// <para>A list of fields representing independent explanatory variables in the regression model.</para>
        /// <para>表示回归模型中独立解释变量的字段列表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Explanatory Variable(s)")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public List<object> _explanatory_variables { get; set; } = null;


        /// <summary>
        /// <para>Explanatory Distance Features</para>
        /// <para>Automatically creates explanatory variables by calculating a distance from the provided features to the Input Features. Distances will be calculated from each of the input Explanatory Distance Features to the nearest Input Features. If the input Explanatory Distance Features are polygons or lines, the distance attributes are calculated as the distance between the closest segments of the pair of features.</para>
        /// <para>通过计算从提供的要素到输入要素的距离来自动创建解释变量。将计算从每个输入解释距离要素到最近输入要素的距离。如果输入说明距离要素为面或线，则距离属性的计算方式为要素对的最近线段之间的距离。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Explanatory Distance Features")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public List<object> _distance_features { get; set; } = null;


        /// <summary>
        /// <para>Prediction Locations</para>
        /// <para>A feature class containing features representing locations where estimates will be computed. Each feature in this dataset should contain values for all the explanatory variables specified. The dependent variable for these features will be estimated using the model calibrated for the input feature class data.</para>
        /// <para>包含表示将计算估计值的位置的要素的要素类。此数据集中的每个要素都应包含所有指定解释变量的值。这些要素的因变量将使用为输入要素类数据校准的模型进行估计。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Prediction Locations")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _prediction_locations { get; set; } = null;


        /// <summary>
        /// <para>Match Explanatory Variables</para>
        /// <para>Matches the explanatory variables in the Prediction Locations to corresponding explanatory variables from the Input Feature Class.</para>
        /// <para>将预测位置中的解释变量与输入要素类中的相应解释变量进行匹配。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Match Explanatory Variables")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _explanatory_variables_to_match { get; set; } = null;


        /// <summary>
        /// <para>Match Distance Features</para>
        /// <para>Matches the distance features specified for the Prediction Locations on the left to corresponding distance features for the Input Features on the right.</para>
        /// <para>将为左侧的“预测位置”指定的距离要素与右侧输入要素的相应距离要素进行匹配。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Match Distance Features")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _explanatory_distance_matching { get; set; } = null;


        /// <summary>
        /// <para>Output Predicted Features</para>
        /// <para>The output feature class to receive dependent variable estimates for each Prediction Location.</para>
        /// <para>用于接收每个预测位置的因变量估计值的输出要素类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Predicted Features")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _output_predicted_features { get; set; } = null;


        public GeneralizedLinearRegression SetEnv(object outputCoordinateSystem = null)
        {
            base.SetEnv(outputCoordinateSystem: outputCoordinateSystem);
            return this;
        }

    }

}